# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=uncaptcha2
pkgver=7.473f33d
pkgrel=9
pkgdesc='Defeating the latest version of ReCaptcha with 91% accuracy.'
groups=('blackarch' 'blackarch-webapp')
url='http://uncaptcha.cs.umd.edu/'
arch=('any')
license=('custom:unknown')
depends=('python' 'python-pyautogui'
         'python-speechrecognition' 'python-xlib')
makedepends=('git')
source=("git+https://github.com/ecthros/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i '1 i\#!/usr/bin/python3' run.py
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin/"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  rm dependencies.txt README.md

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  chmod a+x "$pkgdir/usr/share/$pkgname/run.py"

  ln -fs "/usr/share/$pkgname/run.py" "$pkgdir/usr/bin/$pkgname"
}

